package org.example;

import com.alibaba.fastjson.JSON;
import com.entity.TbClass;
import com.mapper.TbClassMapper;
import com.service.TbClassService;
import com.util.ResponseUtil;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "testService", value = "/testService")
public class TestServiceServlet extends HttpServlet {

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {


        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        TbClassService tbClassService = context.getBean("tbClassService", TbClassService.class);
        tbClassService.doTestSpringWithMybatis();

        ResponseUtil.doPrint(response, "成功打印service");
    }

    public void destroy() {
    }
}